Optimal. Leaf size=106 \[ -\frac {a^2 c x (c+i d)}{d^2 (c-i d)}+\frac {a^2 x (c+2 i d)}{d^2}-\frac {a^2 (-d+i c) \log (c \cos (e+f x)+d \sin (e+f x))}{d f (d+i c)}+\frac {a^2 \log (\cos (e+f x))}{d f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.12, antiderivative size = 106, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3541, 3475, 3484, 3530} \[ -\frac {a^2 c x (c+i d)}{d^2 (c-i d)}+\frac {a^2 x (c+2 i d)}{d^2}-\frac {a^2 (-d+i c) \log (c \cos (e+f x)+d \sin (e+f x))}{d f (d+i c)}+\frac {a^2 \log (\cos (e+f x))}{d f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3484
Rule 3530
Rule 3541
Rubi steps
\begin {align*} \int \frac {(a+i a \tan (e+f x))^2}{c+d \tan (e+f x)} \, dx &=\frac {a^2 (c+2 i d) x}{d^2}-\frac {a^2 \int \tan (e+f x) \, dx}{d}+\frac {(-i a c+a d)^2 \int \frac {1}{c+d \tan (e+f x)} \, dx}{d^2}\\ &=-\frac {a^2 c (c+i d) x}{(c-i d) d^2}+\frac {a^2 (c+2 i d) x}{d^2}+\frac {a^2 \log (\cos (e+f x))}{d f}+\frac {(-i a c+a d)^2 \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{d \left (c^2+d^2\right )}\\ &=-\frac {a^2 c (c+i d) x}{(c-i d) d^2}+\frac {a^2 (c+2 i d) x}{d^2}+\frac {a^2 \log (\cos (e+f x))}{d f}-\frac {a^2 (i c-d) \log (c \cos (e+f x)+d \sin (e+f x))}{d (i c+d) f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 2.85, size = 176, normalized size = 1.66 \[ \frac {a^2 \left ((-2 d-2 i c) \tan ^{-1}(\tan (3 e+f x))-c \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )-i d \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )+2 (d-i c) \tan ^{-1}\left (\frac {d \cos (3 e+f x)-c \sin (3 e+f x)}{c \cos (3 e+f x)+d \sin (3 e+f x)}\right )+c \log \left (\cos ^2(e+f x)\right )-i d \log \left (\cos ^2(e+f x)\right )+8 d f x\right )}{2 d f (c-i d)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.47, size = 84, normalized size = 0.79 \[ \frac {{\left (-i \, a^{2} c + a^{2} d\right )} \log \left (\frac {{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right ) + {\left (i \, a^{2} c + a^{2} d\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{{\left (i \, c d + d^{2}\right )} f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 2.02, size = 127, normalized size = 1.20 \[ \frac {\frac {a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{d} + \frac {4 i \, a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}{c - i \, d} + \frac {a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{d} - \frac {{\left (a^{2} c + i \, a^{2} d\right )} \log \left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - c\right )}{c d - i \, d^{2}}}{f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.24, size = 204, normalized size = 1.92 \[ -\frac {2 i a^{2} \ln \left (c +d \tan \left (f x +e \right )\right ) c}{f \left (c^{2}+d^{2}\right )}-\frac {a^{2} \ln \left (c +d \tan \left (f x +e \right )\right ) c^{2}}{f \left (c^{2}+d^{2}\right ) d}+\frac {a^{2} d \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (c^{2}+d^{2}\right )}+\frac {2 i a^{2} \arctan \left (\tan \left (f x +e \right )\right ) d}{f \left (c^{2}+d^{2}\right )}+\frac {i a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) c}{f \left (c^{2}+d^{2}\right )}+\frac {2 a^{2} \arctan \left (\tan \left (f x +e \right )\right ) c}{f \left (c^{2}+d^{2}\right )}-\frac {a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) d}{f \left (c^{2}+d^{2}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.43, size = 114, normalized size = 1.08 \[ \frac {\frac {{\left (2 \, a^{2} c + 2 i \, a^{2} d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} - \frac {{\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{2} d + d^{3}} - \frac {{\left (-i \, a^{2} c + a^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}}}{f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 5.75, size = 64, normalized size = 0.60 \[ \frac {a^2\,\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,2{}\mathrm {i}}{f\,\left (c-d\,1{}\mathrm {i}\right )}-\frac {a^2\,\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (c+d\,1{}\mathrm {i}\right )}{d\,f\,\left (c-d\,1{}\mathrm {i}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 8.53, size = 92, normalized size = 0.87 \[ \frac {a^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{d f} - \frac {a^{2} \left (c + i d\right ) \log {\left (e^{2 i f x} + \frac {\left (a^{2} c + i a^{2} d + \frac {i a^{2} d \left (c + i d\right )}{c - i d}\right ) e^{- 2 i e}}{a^{2} c} \right )}}{d f \left (c - i d\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________